﻿<Window x:Class="WPFTrees.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="WPF Trees" Height="350" Width="651" MinHeight="100" MinWidth="100" Loaded="Window_Loaded" 
        WindowStartupLocation="CenterScreen">
    <DockPanel HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="dockPanel1" VerticalAlignment="Stretch">
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_File" >
                <MenuItem Header="O_pen" Command="Open" CommandManager.CanExecute="miOpen_CanExecute" />
                <MenuItem Header="_Export as bmp" Click="miExportAsBmp_Click" />
                <MenuItem Header="Load Workspace" Click="miLoadWorkspace_Click" />
                <MenuItem Header="Save Workspace" Click="miSaveWorkspace_Click" />
                <MenuItem Header="E_xit" Click="miExit_Click" />
            </MenuItem>
            <MenuItem Header="_Tree" x:Name="miTree" IsEnabled="False">
                <MenuItem x:Name="miUseBranchLenghts" Header="Use branch lenghts" Click="miUseBranchLenghts_Click" IsEnabled="False" IsCheckable="true" />
                <MenuItem x:Name="miUnroot" Header="Unroot" Click="miUnroot_Click" IsEnabled="False" IsCheckable="true" />
                <MenuItem x:Name="miTreeProperties" Header="Properties..." Click="miTreeProperties_Click" />
            </MenuItem>
            <MenuItem Header="_View">
                <MenuItem Header="Toolbars">
                    <MenuItem x:Name="miStandard" Header="Standard" 
                              IsCheckable="true" IsChecked="True" 
                              Checked="miStandard_Checked"
                              Unchecked="miStandard_UnChecked">                        
                    </MenuItem>
                    <MenuItem x:Name="miLayouts" Header="Layouts" 
                              IsCheckable="true" IsChecked="True" 
                              Checked="miLayouts_Checked"
                              Unchecked="miLayouts_UnChecked">
                    </MenuItem>
                    <MenuItem x:Name="miSearch" Header="Search" 
                              IsCheckable="true" IsChecked="True" 
                              Checked="miSearch_Checked"
                              Unchecked="miSearch_UnChecked">
                    </MenuItem>
                    <MenuItem x:Name="miInserts" Header="Inserts" 
                              IsCheckable="true" IsChecked="True" 
                              Checked="miInserts_Checked"
                              Unchecked="miInserts_UnChecked">
                    </MenuItem>
                    <MenuItem x:Name="miNavigation" Header="Navigation" 
                              IsCheckable="true" IsChecked="True" 
                              Checked="miNavigation_Checked"
                              Unchecked="miNavigation_UnChecked">
                    </MenuItem>
                </MenuItem>
                <MenuItem Header="Colors..." Click="miColors_Click">
                </MenuItem>
                <MenuItem x:Name="miLabels" Header="Labels" >
                    <MenuItem Header="Font..." Click="miFont_Click" />
                    <MenuItem Header="Show labels" x:Name="miShowLabels" IsCheckable="true" IsChecked="True" Click="miShowLabels_Click" />
                    <MenuItem Header="Show internal labels" x:Name="miShowInternalLabels" IsCheckable="true" IsChecked="True" Click="miShowInternalLabels_Click" />
                    <MenuItem Header="Rotate labels" IsCheckable="true" Click="miRotateLabels_Click" />
                    <MenuItem Header="Optimize labels" Click="miOptimizeLabels_Click" />
                </MenuItem>
                
            </MenuItem>
            <MenuItem Header="T_ools">
                <MenuItem Header="_Settings..." Click="miSettings_Click"></MenuItem>
            </MenuItem>
            <MenuItem Header="_Help" >
                <MenuItem Header="_Contents" Click="miContents_Click" />
                <MenuItem Header="_About" Click="miAbout_Click" />
            </MenuItem>
        </Menu>
        <ToolBarTray Height="Auto" Name="toolBarPanel1" DockPanel.Dock="Top" VerticalAlignment="Top" >
            <ToolBar x:Name="tlbStandard" HorizontalAlignment="Left">
                <Button CommandManager.CanExecute="miPrint_CanExecute" Width="24" Height="24" Command="Print" >
                    <Image Source="images/print_24.ico" ToolTip="Print" ></Image>
                </Button>
                <Button Width="24" Height="24" Command="Open" CommandManager.CanExecute="miOpen_CanExecute">
                    <Image Source="images/folder-open_24.ico" ToolTip="Open Tree File" ></Image>
                </Button>
            </ToolBar>
            <ToolBar x:Name="tlbNavigation" VerticalAlignment="Top">
                <Button CommandManager.CanExecute="miZoom_CanExecute" Width="24" Height="24" Command="Zoom" CommandParameter="in" Visibility="Collapsed" ><!--TODO-->
                    <Image Source="images/zoom-in.ico" ></Image>
                </Button>
                <Button CommandManager.CanExecute="miZoom_CanExecute" Width="24" Height="24" Command="Zoom" CommandParameter="out" Visibility="Collapsed"><!--TODO-->
                    <Image Source="images/zoom-out.ico" ></Image>
                </Button>
                <Button Width="24" Height="24" Click="miRotateLeft_Click">
                    <Image Source="images/rotate-left.ico" ToolTip="Rotate Tree By 90° Left" ></Image>
                </Button>
                <Button Width="24" Height="24" Click="miRotateRight_Click">
                    <Image Source="images/rotate-right.ico" ToolTip="Rotate Tree By 90° Right"></Image>
                </Button>
                <Button Width="24" Height="24" Click="miCenterView_Click">
                    <Image Source="images/center-view.ico" ToolTip="Center Tree"></Image>
                </Button>
            </ToolBar>
            <ToolBar x:Name="tblLayouts">
                <Button Width="24" Height="24" Click="miCladogram_Click">
                    <Image Source="images/cladogram.ico" ToolTip="Slanted Cladogram Layout"  />
                </Button>                
                <Button Width="24" Height="24" Click="miRectangular_Click">
                    <Image Source="images/rectangular-cladogram.bmp" ToolTip="Rectangular Cladogram Layout"  />
                </Button>
                <Button Width="24" Height="24" Click="miRadial_Click">
                    <Image Source="images/radial.ico" ToolTip="Radial Layout"  />
                </Button>
                <Button Width="24" Height="24" Click="miRadialClassic_Click">
                    <Image Source="images/radial-classic.bmp" ToolTip="Classic Radial Layout"  />
                </Button>
            </ToolBar>
            <ToolBar Visibility="Collapsed"><!-- TODO -->
                <Button Width="24" Height="24" Click="miCenterTree_Click">
                    <Image Source="images/center-view.ico"></Image>
                </Button>
            </ToolBar>
            <ToolBar x:Name="tblSearch">                
                <Button CommandManager.CanExecute="miFind_CanExecute" Width="24" Height="24" Command="Find">
                    <Image Source="images/search.ico" ToolTip="Find" ></Image>                                            
                </Button>
                <TextBox x:Name="txtBoxFind" KeyDown="txtBoxFind_KeyDown" ToolTip="Find" Text="text" Width="80" />                
            </ToolBar>
            <ToolBar x:Name="tblInserts">
                <Button Width="24" Height="24" Click="miInsertPicture" ToolTip="Insert Picture">
                    Pic
                </Button>
                <Button Width="24" Height="24" Click="miInsertText" ToolTip="Insert Text">
                    Txt
                </Button>
            </ToolBar>
        </ToolBarTray>
        <StatusBar DockPanel.Dock="Bottom" Height="20" Name="statusBar1" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"
                   HorizontalContentAlignment="Stretch">Ready
        </StatusBar>
        <ScrollViewer  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" x:Name="scrollViewer1">
            <Border BorderBrush="Black" BorderThickness="1" >
            
            <Canvas x:Name="parentCanvas" Background="White" MouseMove="parentCanvas_MouseMove" >
                
                    <DockPanel Width="100" Height="100" x:Name="dockPanel">
                    <Canvas DockPanel.Dock="Bottom" x:Name="canvas" SizeChanged="canvas_SizeChanged" 
                         MouseMove="canvas_MouseMove" MouseLeftButtonDown="canvas_MouseLeftButtonDown"
                        MouseLeftButtonUp="canvas_MouseLeftButtonUp" MouseEnter="canvas_MouseEnter" 
                            MouseLeave="canvas_MouseLeave"
                             Canvas.Top="50" Canvas.Left="50" >
                     </Canvas>
                </DockPanel>
                
            </Canvas>
            
        </Border>
        </ScrollViewer>
    </DockPanel>
    
</Window>
